package com.bwie.live.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bwie.live.entity.LiveOrderEntity;
import com.bwie.live.service.LiveOrderService;
import com.bwie.common.utils.PageUtils;
import com.bwie.common.utils.R;



/**
 * 
 *
 * @author lfw
 * @email sunlightcs@gmail.com
 * @date 2022-03-17 09:09:07
 */
@RestController
@RequestMapping("live/liveorder")
public class LiveOrderController {
    @Autowired
    private LiveOrderService liveOrderService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = liveOrderService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		LiveOrderEntity liveOrder = liveOrderService.getById(id);

        return R.ok().put("liveOrder", liveOrder);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody LiveOrderEntity liveOrder){
		liveOrderService.save(liveOrder);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody LiveOrderEntity liveOrder){
		liveOrderService.updateById(liveOrder);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		liveOrderService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
